#ifndef MOUSE_TRANS_HPP
#define MOUSE_TRANS_HPP

#include "gl_data.hpp"
#include "thrid.hpp"

class MouseTrans : public QObject
{
	Q_OBJECT
public:
	MouseTrans(float unit_move, float unit_rot, float unit_scale_);

	void update();

	QMatrix4x4 get_matrix();
	void init_matrix(QMatrix4x4 matrix_);

	void wheel(QWheelEvent *event);
	void move(QMouseEvent *event);
	void press(QMouseEvent *event);
signals:
	void sig_update();
private:
	bool pressed;
	bool inited;
	float rota_x;
	float rota_y;
	float rota_z;
	float move_x;
	float move_y;
	float scale;
	
	float unit_move;
	float unit_rota;
	float unit_scale;

	QPoint pos_last;
	QMatrix4x4 matrix;
	std::shared_ptr<spdlog::logger> logger;

	void set_rota_x(float angle);
	void set_rota_y(float angle);
	void set_rota_z(float angle);
	void normalize_angle(float &angle);
};

#endif